package cn.edu.Bistu.wordsbook;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Map;


public class WordDetailsFragment extends Fragment {


    TextView mWord;
    TextView mMeaning;
    TextView mSample;

    public WordDetailsFragment() {
        // Required empty public constructor
    }




    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment


        View view = inflater.inflate(R.layout.fragment_word_details, container, false);

        //获取从单词列表中传进来的被点击的单词
        Map<String,String> onClicked = (Map<String, String>) getArguments().getSerializable("wordMap");

        mWord = view.findViewById(R.id.details_word);
        mMeaning = view.findViewById(R.id.details_meaning);
        mSample = view.findViewById(R.id.details_sample);

        //设置fragment的组件
        mWord.setText(onClicked.get(Words.Word.COLUMN_WORD));
        mMeaning.setText(onClicked.get(Words.Word.COLUMN_MEANING));
        mSample.setText(onClicked.get(Words.Word.COLUMN_SAMPLE));


        return view;
    }



}